<?php
/**
 * Created by PhpStorm.
 * User: 85210755@qq.com
 * NickName: 柏宇娜
 * Date: 2018/7/4 17:17
 */

function json($data = [], $code = 'success', $type = 'send_msg')
{
    $res = [
        'status' => $code,
        'data'   => $data,
        'type'   => $type
    ];
    if ($code != 'success') {
        $res['msg'] = $data;
    }
    return json_encode($res, JSON_UNESCAPED_UNICODE);
}